package com.js;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class TestPhone {

    public static void main(String[] args) {
//        创建一个数组，将数组里面添加相应的数据，
        Phone[] phones = {new Phone("13533876711",15,28.2),
                new Phone("13533876712",13,23.2),
                new Phone("13533876713",14,29.0),
                new Phone("13533876714",19,233.5),
                new Phone("13533876715",15,29.2),
                new Phone("13533876716",5,59.5),
                new Phone("13533876717",18,28.7),
                new Phone("13533876718",16,70.2),
                new Phone("13533876719",15,291.2),
        };
//        在通过Arrays.sort()对数组的数据进行排序
        Arrays.sort(phones);
        System.out.println(Arrays.asList(phones));
        System.out.println("------------------------------------------------------");
//        Arrays.stream(phones).forEach(System.out::println);
//        实例化一个list的集合列表，将数据存储到list里面，在通过for循环遍历出数据
        List<Phone> list = Arrays.asList(phones);
        for (Phone phone:list){
            System.out.println("遍历出数据："+phone);
        }


    }
}
